import React, { Component } from 'react'
import Child from "./components/Child"
export class AppState extends Component {
    constructor(){
        super()
        console.log("父初始化.onstructor");
        this.state={
            arr:[1,2,3,4,5]
        }
    }
    componentDidMount(){
        console.log("父挂载.componentDidMount");
    }
    btn(){
        console.log(111);
        this.setState({
            arr:[6,7,8,9,10]
        })
    }

    componentDidUpdate(){
        console.log("父更新.componentDidUpdate");
    }
    componentWillUnmount(){
        console.log("父卸载,componentWillUnmount");
    }
    // arr.filter((item)=>item.age>18)
    // arr.filter((item=>{
    //     return item.age>18
    // }))
    render() {
        console.log("父渲染render");
        let {arr} = this.state
        console.log(arr);
        return (
            <div>
                AppState
              
                <Child arr={arr} btn={this.btn.bind(this)}/>
                <button onClick={this.btn.bind(this)}>点我  </button>
            </div>
        )
    }
}

export default AppState
